package hhpoll.dao.hibernate;

import org.hibernate.SessionFactory;

import hhpoll.dao.UserRegistrationDAO;
import hhpoll.domain.UserRegistration;

public class HibernateUserRegistrationDAO extends GenericHibernateDAO<UserRegistration, Long> implements UserRegistrationDAO {

    public HibernateUserRegistrationDAO(SessionFactory sessionFactory) {
        super(sessionFactory);
    }

    public UserRegistration findByUUID (String uuid) {
        return (UserRegistration)this.sessionFactory.getCurrentSession()
                                        .createQuery("from UserRegistration where uuid = :uuid")
                                        .setString("uuid", uuid)
                                        .uniqueResult();
    }

}
